import request from '@/utils/request'

// 查询列表
export function listWord(query) {
  return request({
    url: '/system/word/list',
    method: 'get',
    params: query
  })
}

// 查询详细
export function getWord(wordId) {
  return request({
    url: '/system/word/' + wordId,
    method: 'get'
  })
}

// 新增
export function addWord(data) {
  return request({
    url: '/system/word',
    method: 'post',
    data: data
  })
}

// 修改
export function updateWord(data) {
  return request({
    url: '/system/word',
    method: 'put',
    data: data
  })
}

// 删除
export function delWord(wordId) {
  return request({
    url: '/system/word/' + wordId,
    method: 'delete'
  })
}

// 批量删除
export function deleteWords(data) {
  return request({
    url: '/system/word/deleteWords',
    method: 'delete',
    params: data
  })
}

// 查询班级未分配单词
export function listAllWord() {
  return request({
    url: '/system/word/listAllWord',
    method: 'get'
  })
}

// 查询班级已分配单词
export function listSelectedWord(unitId) {
  return request({
    url: '/system/word/listSelected/' + unitId,
    method: 'get'
  })
}

// 批量添加单元-单词
export function addBatchUnitWord(unitId, wordIds) {
  return request({
    url: '/system/unit/word/addBatch/' + unitId + '/' + wordIds,
    method: 'post'
  })
}

// 批量取消用户授权
export function deleteUnitWordByUnitId(data) {
  return request({
    url: '/system/unit/word/cancelAll',
    method: 'delete',
    params: data
  })
}

// 查询单元下拉树结构
export function unitTreeSelect() {
  return request({
    url: '/system/word/unitTree',
    method: 'get'
  })
}
